#ifndef COD4MAP2_H
#define COD4MAP2_H

#define COD4MAP_VERSION "1.0"
#define COD4MAP_MOTD "All your data are belong to us!"

#ifdef WIN32
    #include <windows.h>
#endif
#include <fstream>
#include <iostream>
#include <vector>
#include <string>
#include <time.h>

typedef struct{
	int offset, length; 
}bspLump_t;

typedef struct{
	char type[4]; 
	int version; 
	std::vector<bspLump_t> lumphead; //lets just say that this is the max number of lumps. I'm too lazy to seek the exact number of lumps in the file. 
}bspHeader_t;

typedef struct{
	float normal[3];
	float dist;
}bspPlane_t;

typedef struct{
	char name[64];
	int flags;
	int contents;
}bspTexture_t;

typedef struct{
	int planeNum[4]; //Positive plane faces out.
	int textureNum; // *** Not in use for decompiling purposes ***
}bspBrushSide_t;

typedef struct{
	signed float firstSide; 
	//int numSides;
	//int textureNum; // *** Not in use for decompiling purposes *** - Used for determining content flags
}bspBrush_t;

typedef struct{
	float xyz[3];
	float st[2]; //The lightmap version of a texture UV coordinate. 
	float lightmap[2];
	float normal[3];
	unsigned char color[4]; //RGBA color for vertex.
}bspVertex_t;

typedef enum{
	MST_BAD,
	MST_PLANAR,
	MST_PATCH,
	MST_TRIANGLE_SOUP,
	MST_FLARE,
	MST_FOLIAGE
}bspSurfaceType_t;

typedef struct{
	int textureNum; 
	int surfaceType;

	int firstVert;
	int numVerts; 

	int firstIndex; 
	int numIndexes; 

	int lightmapWidth, lightmapHeight;

	float lightmapOrigin[3];
	float lightmapVecs[3][3];

	int patchWidth, patchHeight;
}bspFace_t;





#endif